@tool
extends EditorPlugin

const AbilitySystemComponentScript = preload("res://addons/gameplay-ability-system/Scripts/Nodes/AbilitySystemComponent/AbilitySystemComponent.gd")
const AbilityScript = preload("res://addons/gameplay-ability-system/Scripts/Resources/Ability.gd")
const AttributeSetScript = preload("res://addons/gameplay-ability-system/Scripts/Resources/Attribute/AttributeSet.gd")
const TagTreeScript = preload("res://addons/gameplay-ability-system/Scripts/Resources/TagTree.gd")
const EffectTargetCollector3DScript = preload("res://addons/gameplay-ability-system/Scripts/Nodes/EffectTargetCollector3D/EffectTargetCollector3D.gd")

const attribute_set_inspector_plugin_script = preload("res://addons/gameplay-ability-system/Scripts/Inspector/Attribute/attribute_set_inspector.gd")
const attribute_dictionary_inspector_plugin_script = preload("res://addons/gameplay-ability-system/Scripts/Inspector/Attribute/attribute_dictionary_inspector.gd")
const tag_tree_inspector_plugin_script = preload("res://addons/gameplay-ability-system/Scripts/Inspector/Tag/tag_tree_inspector.gd")
const tag_row_inspector_plugin_script = preload("res://addons/gameplay-ability-system/Scripts/Inspector/Tag/tag_row_inspector.gd")
const modifiers_inspector_plugin_script = preload("res://addons/gameplay-ability-system/Scripts/Inspector/Effect/modifiers_inspector.gd")

var AttributeSetInspectorPlugin:EditorInspectorPlugin
var AttributeDictionaryInspectorPlugin:EditorInspectorPlugin
var TagTreeInspectorPlugin:EditorInspectorPlugin
var TagRowInspectorPlugin:EditorInspectorPlugin
var ModifiersInspectorPlugin:EditorInspectorPlugin



func _enter_tree() -> void:
	add_custom_type("AbilitySystemComponent","Node",AbilitySystemComponentScript,null)
	add_custom_type("Ability","Resource",AbilityScript,null)
	add_custom_type("AttirbuteSet","Resource",AttributeSetScript,null)
	add_custom_type("TagTree","Resource",TagTreeScript,null)
	add_custom_type("EffectTargetCollector3D","Area3D",EffectTargetCollector3DScript,null)
	
	AttributeSetInspectorPlugin = attribute_set_inspector_plugin_script.new()
	add_inspector_plugin(AttributeSetInspectorPlugin)
	AttributeDictionaryInspectorPlugin = attribute_dictionary_inspector_plugin_script.new()
	add_inspector_plugin(AttributeDictionaryInspectorPlugin)
	TagTreeInspectorPlugin = tag_tree_inspector_plugin_script.new()
	add_inspector_plugin(TagTreeInspectorPlugin)
	TagRowInspectorPlugin = tag_row_inspector_plugin_script.new()
	add_inspector_plugin(TagRowInspectorPlugin)
	ModifiersInspectorPlugin = modifiers_inspector_plugin_script.new()
	add_inspector_plugin(ModifiersInspectorPlugin)


func _exit_tree() -> void:
	remove_custom_type("AbilitySystemComponent")
	remove_custom_type("AbilityScript")
	remove_custom_type("AttributeSet")
	remove_custom_type("TagTree")
	remove_custom_type("EffectTargetCollector3D")
	
	remove_inspector_plugin(AttributeSetInspectorPlugin)
	remove_inspector_plugin(AttributeDictionaryInspectorPlugin)
	remove_inspector_plugin(TagTreeInspectorPlugin)
	remove_inspector_plugin(TagRowInspectorPlugin)
	remove_inspector_plugin(ModifiersInspectorPlugin)
